package com.stu.mapper;

import com.stu.pojo.StayApplication;
import com.stu.vo.StayApplicationVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StayApplicationMapper {

    @Insert("insert into stay_application(stu_id, application_time, stay_begin, stay_end, status) " +
            "VALUES(#{stuId},#{applicationTime},#{stayBegin},#{stayEnd},#{status})")
    void insertStayApplication(StayApplication stayApplication);

    @Select("select *,stu_basic_information.stu_id as stuBasicId from stay_application,stu_basic_information " +
            "where stay_application.stu_id = #{currentId} " +
            "and stu_basic_information.id = #{currentId}")
    List<StayApplicationVo> selectStayApplicationWithStu(Long currentId);
}
